<style type="text/css">
    #schedulepicker {
        padding-top: 7px;
    }
    
    .fixed-table-toolbar {
        display: none;
    }
</style>

<table id="table" class="table table-striped table-bordered table-hover" data-operate-del="{:$auth->check('expenses/index/del')}" width="100%">
</table>
<fieldset>
    <legend>新增租赁</legend>
    <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
        <div style="display: none;">
            <div class="form-group">
                <label for="community_code" class="control-label col-xs-12 col-sm-2">{:__('Community')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <select id="community_code" data-rule="required" class="form-control selectpicker show-tick" name="row[community_code]" data-live-search="true">
                {foreach name="community" item="vo"}
                <option value="{$vo.code}" {in name="vo.code" value="$row.community_code" }selected{/in}>{$vo.name}
                </option>
                {/foreach}
            </select>
                </div>
            </div>


            <div class="form-group">
                <label for="docid" class="control-label col-xs-12 col-sm-2">{:__('Document')}: </label>
                <div class="col-xs-12 col-sm-6">
                    <input id="docid" data-rule="required" name="row[docid]" value="{$docid}">
                </div>
            </div>

            <div class="form-group">
                <label for="companyid" class="control-label col-xs-12 col-sm-2">{:__('Company')}:</label>
                <div class="col-xs-12 col-sm-6">

                    <input id="companyid" data-rule="required" name="row[companyid]" value="{$cid}">

                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('Pay')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <select id="pay_code" data-rule="required" class="form-control selectpicker show-tick" name="row[pay_code]" data-live-search="true">
                {foreach name="pay" item="vo"}
                <option value="{$vo.code}" {in name="vo.code" value="$row.pay_code" }selected{/in}>{$vo.name}</option>
                {/foreach}
            </select>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="project_code" class="control-label col-xs-12 col-sm-2">{:__('Project')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select id="project_code" data-rule="required" class="form-control selectpicker" name="row[project_code]" data-live-search="true">
            </select>
            </div>
        </div>

        <div class="form-group">
            <label for="house_code" class="control-label col-xs-12 col-sm-2">{:__('House')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select id="house_code" data-rule="required" class="form-control selectpicker" name="row[house_code]" data-live-search="true">
            </select>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('FreeNums')}(天):</label>
            <div class="col-xs-12 col-sm-8">
                <input type="number" class="form-control" id="freenums" name="row[freenums]" value="{$doc.freerent}" data-rule="decimal" placeholder="赠送的天数" />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('ChargeArea')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input type="text" class="form-control" id="chargearea" name="row[chargearea]" value="{$row.chargearea}" data-rule="decimal" placeholder="计入租金有效的面积" />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('UnitPrice')}（年平方元）:</label>
            <div class="col-xs-8 col-sm-4">
                <input type="text" class="form-control" id="firstunitprice" data-rule="decimal" placeholder="每平方每年" />
            </div>
            <div class="col-xs-4 col-sm-4">
                <select id="unittype" class="form-control" style="width: 100px;">
                <option value="1" selected>年</option>
                <option value="2">天</option>
            </select>
            </div>
        </div>




        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('BeginDate')}（&yen;）:</label>
            <div class="col-xs-12 col-sm-6">
                <input id="bgindate" class="form-control" value="{$doc.start_time|date='Y-m-d',###}" name="bgindate" type="text" readonly>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('EndDate')}（&yen;）:</label>
            <div class="col-xs-12 col-sm-6">
                <input id="endate" class="form-control" value="{$doc.end_time|date='Y-m-d' ,###}" name="endate" type="text" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">租期（天）:</label>
            <div class="col-xs-12 col-sm-6">
                <input id="times" class="form-control" value="{$doc.end_time/86400-$doc.start_time/86400}" name="times" type="text" style="width: 200px;" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('PriceRules')}:</label>

            <div class="col-xs-6 col-sm-6">
                <input type="text" class="form-control" id="intervalYear" name="intervalYear" data-rule="decimal" placeholder="间隔年数" style="width: 100px;" value="{$doc.cycle}" /> 年起，每年增加 <input type="text" class="form-control" id="rate" name="rate" data-rule="decimal"
                    placeholder="增长比" style="width: 100px;" value="{$doc.percentage}" />%
            </div>

        </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-6 col-sm-6">
                <button id="btnstages" class="btn btn-danger" type="button" onclick="addplan()">计算租金</button>
            </div>
        </div>
        <div id="mypayplan" style="display: none;">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">合同总价（&yen;）:</label>
                <div class="col-xs-6 col-sm-6">
                    <input type="text" class="form-control" id="doc_amount_total" name="doc_amount_total" data-rule="decimal" placeholder="留空自动计算" readonly/>
                </div>
            </div>
            <div id="payplan" class="payplan">
                <fieldset>
                    <legend>租期：<span name="remark"></span> </legend>
                    <div class="form-group">
                        <label for="amount_total" class="control-label col-xs-12 col-sm-2">{:__('AmountTotal')}（&yen;）:</label>
                        <div class="col-xs-6 col-sm-6">
                            <input type="text" class="form-control totalmoney" id="amount_total" name="amount_total" value="{$row.amount_total}" data-rule="required;decimal" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="payment_date" class="control-label col-xs-12 col-sm-2">{:__('PaymentDate')}（&yen;）:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-payment_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="payment_date" type="text" value="{$row.payment_date|datetime}">
                        </div>
                    </div>
                    <input type="hidden" name="amount_unitprice" />
                    <input type="hidden" name="remark" />
                </fieldset>
            </div>
        </div>
        <div class="form-group" style="display: none;">
            <label for="amount_paid" class="control-label col-xs-12 col-sm-2">{:__('AmountPaid')}（&yen;）:</label>
            <div class="col-xs-12 col-sm-6">
                <input type="text" class="form-control" id="amount_paid" name="row[amount_paid]" value="{$row.amount_paid}" data-rule="required;decimal" />
            </div>
        </div>
        <!-- <div class="form-group">
            <label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea class="form-control" id="remark" name="row[remark]">{$row.remark}</textarea>
            </div>
        </div> -->
        <div class="form-group hide layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="button" class="btn btn-success btn-embossed" id="bntSubmit" onclick="submitData(0)">{:__('OK')}</button>
                <button type="button" class="btn btn-default btn-embossed" onClick="closeLayerWin(this)">{:__('Close')}</button>
            </div>
        </div>

    </form>
</fieldset>
<input type="hidden" name="house_id" id="house_id" value="{$row.house_code}" />
<input type="hidden" name="project_id" id="project_id" value="{$row.project_code}" />
<input type="hidden" name="times" id="times" value="0" />
<input type="hidden" name="row[amount_total]" id='row[amount_total]' />
<input type="hidden" name="isfix" id="isfix" value="0" />